package com.ubird.demo;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import com.ubird.tetris.ui.GamePanel;
import com.ubird.tetris.ui.ScorePanel;
import com.ubird.ui.UFrame;
import com.ubird.ui.event.RepeatingReleasedEventsFixer;

public class TetrisDemo {

    public final static String VERSION = "V0.8.0";
    public final static String AUTHOR = "JohnCha";

    public static void main(String[] args) {
        new RepeatingReleasedEventsFixer().install();
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                UFrame frame = new UFrame("Algorithm Tetris " + VERSION + "  By " + AUTHOR);
                ScorePanel scorePanel = new ScorePanel(200, 0);
                GamePanel gamePanel = new GamePanel(18, 32, 20, scorePanel);
                frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
                frame.getContentPane().add(scorePanel, BorderLayout.EAST);
                frame.pack();
                frame.setVisible(true);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                // frame.setResizable(false);
                gamePanel.requestFocus();
            }
        });
    }

}